home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: george potts <solvris@halcyon.com>
- Newsgroups: comp.lang.c
- Subject: Re: Newbie question: byte order
- Date: Wed, 06 Mar 1996 11:42:02 -0800
- Organization: Solveris Inc
- Message-ID: <313DEA8A.665E@halcyon.com>
- References: <4hdhjl$m22@nnrp1.news.primenet.com>
- NNTP-Posting-Host: blv-pm2-ip24.halcyon.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Dineh Alliance wrote:
- >
- > I have found Turbo C++ a good package for developing data conversion routines,
- > but recently I encountered a data concept not covered in their online
- > documentation (or at least I can't find it):
- >
- > byte order (i.e. "bigendian" vs. "littleendian").
- >
- > What is it? Are there any good books or Web/Gopher resources that discuss it?
- >
- > Thanks in advance for your help!
- >
- > Mark Cederholm
-
- byte order refers to the way binary data, such as integers, are
- stored in memory. as i recall, IBM uses bigendian and DEC and
- Intel use littleendian. to convert from one system to the other
- you reverse the order of the bytes.
- if you have programmed with sockets you should have used htons,
- htonl, ntohs, ntohl. these functions essentially do the
- conversion from the (h)ost to (n)etwork and vice-versa. this
- causes binary data over the network to be consistent.
-
- george
-